package com.szy.douyou_gateway.client;


import com.szy.douyou_classification.dao.Classification;
import com.szy.douyou_classification.dao.ClassificationReq;
import com.szy.douyou_gateway.config.ResultDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

/**
 * @author sunziyan
 * @date 2022/5/12
 */
@Component
@FeignClient("nacos-douyou-classification")
public interface ClassificationClient {

    /**
     * 调用接口查询所有分类
     * @param classificationReq
     * @return
     */
    @PostMapping("/classification/queryAll")
    ResultDTO queryAll(@RequestBody ClassificationReq classificationReq);

    /**
     * 调用接口查询单个分类
     *
     * @param classificationId
     * @return
     */
    @GetMapping("/classification/queryOne/{classificationId}")
    ResultDTO<Classification> queryOne(@PathVariable("classificationId") Long classificationId);



    /**
     * 通过接口插入单条分类信息
     *
     * @param classification
     * @return
     */
    @PostMapping("/classification/addOne")
    ResultDTO<Boolean> addOne(@RequestBody Classification classification);


    /**
     * 通过接口更新单条分类信息
     *
     * @param classification
     * @return
     */
    @PostMapping("/classification/updateOne")
    ResultDTO<Boolean> updateOne(@RequestBody Classification classification);



    /**
     * 删除该分类以及其所有子分类
     *
     * @param id
     * @return
     */
    @GetMapping("/classification/deleteOne/{id}")
    ResultDTO<Integer> deleteOne(@PathVariable("id") Long id);



}
